<extend name="Layout:layout_content" />
<block name="body_main">
    <div class="grid-parent xsui-page-header">
        <div class="grid-60 mobile-grid-100 grid-parent">
            <a href="{:U('link_edit')}" class="xsui-btn ui-state-default xsui-lnk-add-dialog"><i class="fa fa-plus"></i>新增</a>
            <a href="{:U('link_delete','id=varkey')}" class="xsui-btn ui-state-default xsui-lnk-remove"><i class="fa fa-remove"></i>批量删除</a>
        </div>
        <div class="grid-40 mobile-grid-100 grid-parent xsui-text-right">
            <a href="#" class="xsui-btn ui-state-default xsui-lnk-refresh"><i class="fa fa-refresh"></i>刷新</a>
            <span class="xsui-input-group"><form method="get"><input type="text" name="search_key" value="{$search.search_key}" placeholder="标题" /><button type="submit" class="ui-state-default"><i class="fa fa-search"></i>搜索</button><button id="btn-search-dialog" class="ui-state-default xsui-icon-only" title="高级搜索"><i class="fa fa-gear"></i></button></form></span>
        </div>
        <div id="search-dialog" class="xsui-hidden">
            <form method="get" class="xsui-form">
                <div class="xsui-form-field">
                    <label>类型：</label><input type="text" name="type" value="{$search.user_name}" />
                </div>
                <div class="xsui-form-field">
                    <label>分组：</label><input type="text" name="group" value="{$search.site_id}" />
                </div>
                <button type="submit">保存</button>
            </form>
        </div>
    </div>
    <div id="grid-container" data-url="__ACTION__">
        {$content}
    </div>
</block>
<block name="body_after">    
    <script type="text/javascript">
        $(function () {
            
            var gridPage=GridPage.newInstance();
            
            // 动态更改排序 2015-10-24 SoChishun Added.
            $('td.sort input').blur(function () {
                var $input = $(this);
                var old_v = $input.data('value');
                if ($input.val() == old_v) {
                    return;
                }
                $.get($input.data('url').replace('varsort', $input.val()), function (data) {
                    if (data.status) {
                        location.reload();
                    } else {
                        $('<div>' + data.info + '</div>').dialog();
                    }
                })
            })
        })
    </script>
</block>